from rest_framework import serializers
from ..models import Character

class CharacterListSerializers(serializers.ModelSerializer):
    """角色列表序列化器"""
    class Meta:
        model = Character
        fields = ['id', 'name', 'description','created_at','updated_at']
        read_only_fields = ['id', 'created_at', 'updated_at']


class CharacterDetailSerializers(serializers.ModelSerializer):
    """角色详情序列化器"""
    class Meta:
        model = Character
        fields = ['id', 'name', 'description', 'constitution', 'strength', 'spirit',
                  'intelligence', 'luck', 'max_hp', 'max_mp',
                  'physical_armor', 'magic_armor', 'damage_reduction', 'damage_reduction_percentage',
                  'shield_value', 'block_value', 'dodge_rate', 'damage_bonus', 'damage_bonus_percentage',
                  'crit_rate', 'crit_damage', 'life_steal', 'armor_penetration', 'healing_bonus',
                  'healing_bonus_percentage', 'hp_regen', 'movement_speed', 'attack_range', 'flying_height',
                  'current_hp', 'current_mp', 'current_physical_armor', 'current_magic_armor',
                  'current_damage_reduction', 'current_damage_reduction_percentage',
                  'current_shield_value', 'current_block_value', 'current_dodge_rate', 'current_damage_bonus',
                  'current_damage_bonus_percentage', 'current_crit_rate', 'current_crit_damage',
                  'current_life_steal', 'current_armor_penetration', 'current_healing_bonus',
                  'current_healing_bonus_percentage', 'current_hp_regen', 'current_movement_speed',
                  'current_attack_range', 'current_flying_height', 'created_at', 'updated_at'
                  ]
        read_only_fields = ['id', 'created_at', 'updated_at']

class CharacterCreateSerializers(serializers.ModelSerializer):
    """创建角色序列化器"""
    class Meta:
        model = Character
        fields = ['id', 'name', 'description', 'constitution', 'strength', 'spirit',
                  'intelligence', 'luck', 'max_hp', 'max_mp',
                  'physical_armor', 'magic_armor', 'damage_reduction', 'damage_reduction_percentage',
                  'shield_value', 'block_value', 'dodge_rate', 'damage_bonus', 'damage_bonus_percentage',
                  'crit_rate', 'crit_damage', 'life_steal', 'armor_penetration', 'healing_bonus',
                  'healing_bonus_percentage', 'hp_regen', 'movement_speed', 'attack_range', 'flying_height'
                  ]
        read_only_fields = ['id', 'created_at', 'updated_at']
    

class CharacterUpdateSerializers(serializers.ModelSerializer):
    """更新角色序列化器"""
    class Meta:
        model = Character
        fields = ['id', 'name', 'description', 'constitution', 'strength', 'spirit',
                  'intelligence', 'luck', 'max_hp', 'max_mp',
                  'physical_armor', 'magic_armor', 'damage_reduction', 'damage_reduction_percentage',
                  'shield_value', 'block_value', 'dodge_rate', 'damage_bonus', 'damage_bonus_percentage',
                  'crit_rate', 'crit_damage', 'life_steal', 'armor_penetration', 'healing_bonus',
                  'healing_bonus_percentage', 'hp_regen', 'movement_speed', 'attack_range', 'flying_height',
                  'current_hp', 'current_mp', 'current_physical_armor', 'current_magic_armor',
                  'current_damage_reduction', 'current_damage_reduction_percentage',
                  'current_shield_value', 'current_block_value', 'current_dodge_rate', 'current_damage_bonus',
                  'current_damage_bonus_percentage', 'current_crit_rate', 'current_crit_damage',
                  'current_life_steal', 'current_armor_penetration', 'current_healing_bonus',
                  'current_healing_bonus_percentage', 'current_hp_regen', 'current_movement_speed',
                  'current_attack_range', 'current_flying_height', 'created_at', 'updated_at'
                  ]
        read_only_fields = ['id', 'created_at', 'updated_at']
    
class CharacterDeleteSerializers(serializers.ModelSerializer):
    """删除角色序列化器"""
    class Meta:
        model = Character
        fields = ['id']
        read_only_fields = ['id']

